/*
 * @Description: 提现记录
 * @Author: iamsmiling
 * @Date: 2021-06-13 14:01:04
 * @LastEditTime: 2021-06-13 14:59:50
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/common_kit/color_kit.dart';
import 'package:credit_business_circle/components/button/roatet_button.dart';
import 'package:credit_business_circle/domain/remote/bill/with_drawal_record_entity.dart';
import 'package:flutter/material.dart';

class WithDrawalFragment extends StatelessWidget {
  final List<WithdrawalRecordEntity> records;
  const WithDrawalFragment({Key? key, required this.records}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(
                left: R.dimen.dp12,
                right: R.dimen.dp12,
                top: R.dimen.dp18,
                bottom: R.dimen.dp15),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  padding: EdgeInsets.symmetric(
                      horizontal: R.dimen.dp16, vertical: R.dimen.dp8),
                  decoration: BoxDecoration(
                      color: R.color.ffffffff,
                      borderRadius: BorderRadius.circular(R.dimen.sp20)),
                  child: RotateButton(
                    onPressed: () => Future.value(),
                    label: Container(
                      margin: EdgeInsets.only(right: R.dimen.dp6),
                      child: Text(
                        "2020-03",
                        style: TextStyle(
                            fontSize: R.dimen.sp12, color: R.color.ff333333),
                      ),
                    ),
                  ),
                ),
                Text(
                  "提现星币：660星币",
                  style: TextStyle(
                      fontSize: R.dimen.sp13,
                      color: R.color.ff333333,
                      fontWeight: FontWeight.w600),
                )
              ],
            ),
          ),
          Container(
              margin: EdgeInsets.only(left: R.dimen.dp15, bottom: R.dimen.dp18),
              child: Text(
                "注：到账金额为税后，处理时间为：每月1-7号处理",
                style:
                    TextStyle(fontSize: R.dimen.sp12, color: R.color.ff666666),
              )),
          Container(
            padding: EdgeInsets.symmetric(horizontal: R.dimen.dp12),
            color: R.color.ffffffff,
            child: ListView.separated(
                shrinkWrap: true,
                padding: EdgeInsets.zero,
                itemBuilder: (BuildContext context, int i) {
                  WithdrawalRecordEntity r = records[i];
                  return Container(
                      padding: EdgeInsets.symmetric(vertical: R.dimen.dp20),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Row(
                                children: [
                                  Text("●    ",
                                      style: TextStyle(
                                          fontSize: R.dimen.sp6,
                                          // fontWeight: FontWeight.bold,
                                          color: R.color.ff1d9c76)),
                                  Text.rich(TextSpan(
                                      text: r.label + "：",
                                      style: TextStyle(
                                          fontSize: R.dimen.sp13,
                                          color: R.color.ff333333),
                                      children: [
                                        TextSpan(
                                            text: "${r.star}星币",
                                            style: TextStyle(
                                                fontSize: R.dimen.sp15,
                                                color: R.color.fffb5c06,
                                                fontWeight: FontWeight.w500))
                                      ]))
                                ],
                              ),
                              Container(
                                margin: EdgeInsets.only(top: R.dimen.dp10),
                                child: Row(
                                  children: [
                                    Text("●    ",
                                        style: TextStyle(
                                            fontSize: R.dimen.sp6,
                                            // fontWeight: FontWeight.bold,
                                            color: R.color.transparent)),
                                    Text(
                                      r.date,
                                      style: TextStyle(
                                          color: R.color.ff888888,
                                          fontSize: R.dimen.sp11),
                                    )
                                  ],
                                ),
                              ),
                            ],
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                r.rmb + "元",
                                style: TextStyle(
                                    fontSize: R.dimen.sp15,
                                    color: R.color.ff111111,
                                    fontWeight: FontWeight.w600),
                              ),
                              Container(
                                child: Text(
                                  "${r.channel}",
                                  style: TextStyle(
                                      fontSize: R.dimen.sp10,
                                      color: R.color.ff888888),
                                ),
                              )
                            ],
                          ),
                          Column(
                            children: [
                              Text(
                                r.status.name,
                                style: TextStyle(
                                    fontSize: R.dimen.sp13,
                                    fontWeight: FontWeight.w500,
                                    color: ColorKit.fromHex(r.status.color)),
                              ),
                              Visibility(
                                  visible: r.status.description.isNotEmpty,
                                  child: Container(
                                    margin: EdgeInsets.only(top: R.dimen.dp5),
                                    child: Text(
                                      r.status.description,
                                      style: TextStyle(
                                          fontSize: R.dimen.sp11,
                                          color: R.color.ff666666),
                                    ),
                                  ))
                            ],
                          )
                        ],
                      ));
                },
                separatorBuilder: (BuildContext context, int i) {
                  return Divider(
                    height: 1,
                  );
                },
                itemCount: records.length),
          )
        ],
      ),
    );
  }
}
